package com.bw.listen;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = "group1",topic = "xixi1")
@Slf4j
public class ConsumerDemo implements RocketMQListener {
    @Override
    public void onMessage(Object o) {
        //每次消费一条消息需要1秒的时间
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        log.info("消费者"+o);
    }
}
